Skip to content

Escape store auth session keys#7864

Merged
alfonso-noriega merged 1 commit into
mainfrom
donald/store-auth-escaped-session-keys
Jun 19, 2026
Merged

Escape store auth session keys#7864
alfonso-noriega merged 1 commit into
mainfrom
donald/store-auth-escaped-session-keys

Conversation

@alfonso-noriega

@alfonso-noriega alfonso-noriega commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Follow-up to discussion on #7709 about avoiding recursive crawling of conf storage for store-auth sessions.

WHAT is this pull request doing?

Escapes dots in store-auth session keys before passing them to conf, so a store domain is persisted as one top-level key instead of a nested dotted path. The listing code now scans only top-level store-auth buckets and ignores legacy nested entries.

This intentionally means stores authenticated with the old nested key format may need to be re-authenticated.

How to test your changes?

pnpm --filter @shopify/store vitest src/cli/services/store/auth/session-store.test.ts src/cli/services/store/auth/stored-auth.test.ts
pnpm --filter @shopify/store lint
pnpm --filter @shopify/store type-check

Post-release steps

None.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

alfonso-noriega commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jun 19, 2026
@alfonso-noriega alfonso-noriega marked this pull request as ready for review June 19, 2026 11:13
@alfonso-noriega alfonso-noriega requested a review from a team as a code owner June 19, 2026 11:13
}

function escapeStoreAuthSessionKeySegment(value: string): string {
return value.replace(/\./g, '\\.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it better to escape or to replace them? maybe is safer to use -?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think escaping is safer here than replacing with -: - is valid in store domains, so replacement can create collisions between distinct domains. dot-prop explicitly supports escaped dots for this exact case, and the persisted JSON key remains the original domain string rather than an encoded/replaced value. If we want to avoid relying on dot-prop escaping semantics entirely, I think encodeURIComponent(store) would be the safer alternative over - replacement.

@alfonso-noriega alfonso-noriega force-pushed the donald/store-auth-escaped-session-keys branch from a571bc3 to 9e2c4f3 Compare June 19, 2026 11:18
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-local-fallback branch 2 times, most recently from 067f712 to 57d47f2 Compare June 19, 2026 11:55
@alfonso-noriega alfonso-noriega force-pushed the donald/store-auth-escaped-session-keys branch 3 times, most recently from a868c3a to c324278 Compare June 19, 2026 12:29
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-local-fallback branch from 57d47f2 to 3f7e81a Compare June 19, 2026 12:29
@alfonso-noriega alfonso-noriega force-pushed the donald/store-auth-escaped-session-keys branch from c324278 to fcf52d3 Compare June 19, 2026 16:30
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-local-fallback branch from 3f7e81a to 849999d Compare June 19, 2026 16:30
@github-actions

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/local-storage.d.ts
@@ -1,3 +1,14 @@
+/**
+ * Escape a value so it can be safely used as a single  path segment.
+ *
+ *  treats dots and brackets as path syntax (via dot-prop), so dynamic
+ * segments containing those characters need to be escaped before they are used
+ * in local storage keys.
+ *
+ * @param value - The dynamic local storage key segment to escape.
+ * @returns The escaped key segment.
+ */
+export declare function localStorageKeySegment(value: string): string;
 /**
  * A wrapper around the  package that provides a strongly-typed interface
  * for accessing the local storage.

@alfonso-noriega alfonso-noriega force-pushed the donald/store-auth-escaped-session-keys branch from fcf52d3 to 1957170 Compare June 19, 2026 16:38
Assisted-By: devx/a802aefd-9486-4d1e-bf5d-9541c093b99d
@alfonso-noriega alfonso-noriega force-pushed the donald/store-auth-escaped-session-keys branch from 1957170 to 6bc6e16 Compare June 19, 2026 17:07
Base automatically changed from donald/store-list-local-fallback to main June 19, 2026 17:39
@alfonso-noriega alfonso-noriega added this pull request to the merge queue Jun 19, 2026
Merged via the queue into main with commit 5ddd8e4 Jun 19, 2026
26 checks passed
@alfonso-noriega alfonso-noriega deleted the donald/store-auth-escaped-session-keys branch June 19, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants